//
//  RemarksViewController.m
//  cityStar
//
//  Created by joyban on 14-12-29.
//  Copyright (c) 2014年 tiny. All rights reserved.
//

#import "RemarksViewController.h"
#import "RJPlaceHolderTextView.h"
#import "UIColor+FlatUI.h"

@interface RemarksViewController ()<UITextViewDelegate>
@property (weak, nonatomic) IBOutlet RJPlaceHolderTextView *beizhuTextView;


@end

@implementation RemarksViewController

-(void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"备注";
    self.beizhuTextView.placeholder = @"编辑内容";
    self.beizhuTextView.placeholderColor = [UIColor colorFromHexCode:@"c4c4c4"];
    [self.beizhuTextView becomeFirstResponder];
    [self addBackButton];
    __weak typeof(self)weakSelf = self;
    [self addRightButtonWithTitle:@"完成" actionBlock:^{
        [weakSelf.navigationController popViewControllerAnimated:YES];
        if ([weakSelf.delegate respondsToSelector:@selector(remarksVCTouchFinishWithMarks:)]) {
            [weakSelf.delegate remarksVCTouchFinishWithMarks:weakSelf.beizhuTextView.text];
        }
    }];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(BOOL)textViewShouldBeginEditing:(UITextView *)textView
{
    return YES;
}

-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{
    if ([text isEqualToString:@"\n"]){ //判断输入的字是否是回车，即按下return
        //在这里做你响应return键的代码
        return NO; //这里返回NO，就代表return键值失效，即页面上按下return，不会出现换行，如果为yes，则输入页面会换行
    }
    
    return YES;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
